//
//  UIButton+BVButtonAnimation.m
//  BuyVegetable
//
//  Created by yushanchang on 16/11/1.
//  Copyright © 2016年 com.yinding. All rights reserved.
//

#import "UIButton+BVButtonAnimation.h"

@implementation UIButton (BVButtonAnimation)

- (void)buttonClickAnimation:(UIButton *)button {
    
    button.transform = CGAffineTransformIdentity;
    [UIView animateKeyframesWithDuration:0.5 delay:0 options:0 animations: ^{
        [UIView addKeyframeWithRelativeStartTime:0 relativeDuration:1 / 3.0 animations: ^{
            button.transform = CGAffineTransformMakeScale(1.5, 1.5);
        }];
        [UIView addKeyframeWithRelativeStartTime:1/3.0 relativeDuration:1/3.0 animations: ^{
            button.transform = CGAffineTransformMakeScale(0.8, 0.8);
        }];
        [UIView addKeyframeWithRelativeStartTime:2/3.0 relativeDuration:1/3.0 animations: ^{
            button.transform = CGAffineTransformMakeScale(1.0, 1.0);
        }];
    } completion:nil];
}

@end
